package com.qjq.glasses_shopping.controller;

import com.qjq.glasses_shopping.pojo.Category;
import com.qjq.glasses_shopping.result.BaseResult;

import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.qjq.glasses_shopping.service.CategoryService;

import java.util.List;
//前台广告
@RestController
@RequestMapping("/user/category")
public class UserCategoryController {
    @Resource
    private CategoryService categoryService;

    /**
     * 获取广告
     * @return 返回执行结果
     */
    @RequestMapping("/all")
    public BaseResult<List<Category>> getAllCategory() {
        List<Category> categories = categoryService.findAll();
        return BaseResult.ok(categories);
    }
}
